Methodology: Calculation of Outdoor Public Space Area per Spatial Unit

1. Overview
The objective of this spatial analysis was to calculate the total area of outdoor public spaces and their proportional representation relative to the built-up area within 94 defined spatial units (neighborhoods). The public space dataset comprised six distinct vector layers (e.g., pedestrian areas, vehicular circulation, parks, markets), which presented a computationally intensive geoprocessing challenge due to the high density and complexity of the multipolygon geometries. 

2. Computational Strategy and Memory Optimization
Global overlay operations (such as a global union or dissolve) on large-scale municipal vector datasets frequently exceed standard memory capacities (RAM) and result in system exhaustion. To mitigate this, a localized, iterative spatial geoprocessing pipeline was developed using Python, specifically leveraging the `geopandas` and `shapely` libraries. Attributes from the public space layers were stripped during the ingestion phase, retaining only the geometric data to drastically minimize the memory footprint.

3. Step-by-Step Processing Workflow
The script employs a "Spatial Index Loop" to efficiently process the geometries:

Step 3.1: Spatial Indexing
A spatial index based on an R-tree data structure was built for the consolidated public space geometries. The R-tree efficiently organizes polygons by their Minimum Bounding Rectangles (MBR), allowing the system to rapidly filter out geometries that are geographically distant from the target spatial unit without performing costly exact-geometry checks.

Step 3.2: Two-Tier Intersection
For each of the 94 spatial units, the script applies a two-tier spatial query:
- First Tier (Bounding Box Query): The spatial index retrieves only the public space geometries whose bounding boxes intersect the bounding box of the spatial unit.
- Second Tier (Precise Query): A precise geometric intersection check is performed on the subset identified in the first tier to confirm actual overlap.

Step 3.3: Geoprocessing (Clipping and Dissolving)
Public spaces extending beyond the boundaries of a given spatial unit were geographically clipped to the spatial unit's perimeter. Following the clip, all public space fragments within the spatial unit were merged using a unary union (dissolve). This step is critical to avoid double-counting areas where different public space layers might overlap (e.g., a pedestrian area intersecting a vehicular area).

Step 3.4: Metric Calculation
Because the source datasets were projected in a metric Coordinate Reference System (CRS EPSG:3003 - Monte Mario), the planar area of the dissolved geometries could be calculated directly in square meters and subsequently converted to square kilometers. The percentage of public space relative to the neighborhood's built-up area was derived by dividing the total clipped public space area by the pre-existing built-up area attributes.

4. Standard Principles and Academic Sources

The methodology relies on foundational principles of Geographic Information Science (GISc), specifically spatial indexing and vector overlay analysis.

- Spatial Indexing (R-tree): The use of bounding box queries to optimize spatial database operations was introduced by Antonin Guttman. 
  Source: Guttman, A. (1984). "R-trees: A Dynamic Index Structure for Spatial Searching". Proceedings of the 1984 ACM SIGMOD International Conference on Management of Data, 47-57. https://doi.org/10.1145/602259.602266

- Vector Overlay and Clipping: The principles of Boolean spatial operations (intersection, union) used for clipping and dissolving geometries are core concepts of cartographic modeling.
  Source: Tomlin, C. D. (1990). "Geographic Information Systems and Cartographic Modeling". Prentice-Hall. 
  Source: Longley, P. A., Goodchild, M. F., Maguire, D. J., & Rhind, D. W. (2015). "Geographic Information Science and Systems" (4th ed.). Wiley.

- Computational Geometry (The GEOS Library): The underlying geometric operations (unary union, exact intersection) performed by the `shapely` library in Python rely on the GEOS (Geometry Engine - Open Source) C++ library, which implements the OpenGIS Simple Features for SQL spatial predicate functions and spatial operators.
